package com.ejuornal.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.ejuornal.bean.Check;
import com.ejuornal.dao.impl.CheckDaoImpl;
import com.ejuornal.service.CheckService;

@Component("checkService")
public class CheckServiceImpl implements CheckService {
	private CheckDaoImpl checkDaoImpl;

	public void add(Check check) {
		String sql = "insert into t_check (articalId,userId,suggestion,status,checkDate) values (?,?,?,?,?)";
		checkDaoImpl.add(
				sql,new Object[] { 
						check.getArticalId(), 
						check.getUserId(),
						check.getSuggestion(), 
						check.getStatus(),
						check.getCheckDate() 
						});
	}

	public void delete(int... checkIds) {
		String sql = "delete from t_check where checkId = ?";
		checkDaoImpl.batchDelete(sql, checkIds);
	}

	public List<Check> findById(int articalId) {
		List<Check> list = checkDaoImpl.findById(articalId);
		return list;
	}

	public Check detailCheckInfo(int checkId) {
		Check check = checkDaoImpl.detailCheckInfo(checkId);
		return check;
	}

	@Override
	public Check findSuggestion(int articalId) {
		return checkDaoImpl.findSuggestion(articalId);
	}
	
	public CheckDaoImpl getCheckDaoImpl() {
		return checkDaoImpl;
	}

	@Resource(name = "checkDao")
	public void setCheckDaoImpl(CheckDaoImpl checkDaoImpl) {
		this.checkDaoImpl = checkDaoImpl;
	}

	@Override
	public List<Check> findCommitById(int articalId) {
		// TODO Auto-generated method stub
		List<Check> list = checkDaoImpl.findById(articalId);
		return list;
	}


}
